<!DOCTYPE html>
<html lang="en">

<head>
     <meta charset="UTF-8">
     <title>社团端</title>
     <meta name="viewport" content="width=device-width, initial-scale=1">
     <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
     <link rel="stylesheet" href="css/app.css">
     <script src="js/template.js"></script>
     <script src="./js/jquery-1.12.4.min.js"></script>
     <script src="js/jquery.form.js"></script>
     <script src="./js/jquery.mobile-1.4.5.min.js"></script>
     <script>
          var ASSID;
     </script>
</head>

<body>
     <!----------------------------海报栏海报栏页面---------------------------------->
     <div data-role="page" id="as_post" data-theme="s" data-dom-cache="true">
          <script>
               $("#as_post").on("pagebeforecreate", function (e) {
                    ASSID = window.location.href.slice(-3);
                    var you_circle_icon;
                    $.ajax({
                         url: "http://123.206.198.158:9093/get_depimage"
                         , data: {
                              id: ASSID
                         }
                         , cache: true
                         , async: false
                         , type: "POST"
                         , dataType: "text"
                         , success: function (data) {
                              you_circle_icon = data;
                         }
                    });
                    $("#circle_tea_icon").attr("src", you_circle_icon);
                    var receive_post_data;
                    $.ajax({
                         url: "http://123.206.198.158:9093/get_studentnews"
                         , data: {}
                         , cache: true
                         , async: false
                         , type: "POST"
                         , dataType: "JSON"
                         , success: function (data) {
                              receive_post_data = data;
                         }
                    });
                    var post_data = {
                         list: receive_post_data
                    };
                    $("#post_student_student_ul").append(template("student_show_student_post", post_data));
               });
          </script>
          <script>
               $(document).on("pagecreate", "#as_post", function () {
                    $(document).on("swiperight", "#as_post", function (e) {
                         // We check if there is no open panel on the page because otherwise
                         // a swipe to close the left panel would also open the right panel (and v.v.).
                         // We do this by checking the data that the framework stores on the page element (panel: open).
                         if ($(".ui-page-active").jqmData("panel") !== "open") {
                              if (e.type === "swiperight") {
                                   $("#person").panel("open");
                              }
                         }
                    });
               });
               var go_index = function () {
                    window.self.location = "index.html";
               }
          </script>
          <!--学生组织海报栏模板-->
          <script id="student_show_student_post" type="text/html"> {{each list as value i}}
               <li id="student_student_post_list">
                    <div class="post-show-div">
                         <div class="post-show-div-inner-left"><img src={{value.icon}} alt=""></div>
                         <div class="post-show-div-inner-right">
                              <a href="#popup-post{{i+1}}" data-rel="popup" data-position-to="window" data-transition="flow"><img src={{value.pic}} alt=""></a>
                         </div>
                         <div data-role="popup" id="popup-post{{i+1}}" data-overlay-theme="s" data-corners="false"><a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-s ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a><img src={{value.pic}} alt=""></div>
                    </div>
               </li> {{/each}} </script>
          <!--学生组织海报栏渲染-->
          <script>
          </script>
          <div data-role="header" data-tap-toggle="false" data-position="fixed" data-fullscreen="true" data-theme="s">
               <div data-role="navbar" class="top_nav_bar">
                    <ul>
                         <li class="msg-top-nav-head" data-role="controlgroup" data-type="horizontal">
                              <a href="#person" data-theme="l" data-role="button" onclick="showPrivate()"><img id="circle_tea_icon" alt="个人中心" class="nav_header_img"></a>
                         </li>
                         <li class="msg-top-nav" data-role="controlgroup" data-type="horizontal" data-theme="j"><a href="#" class="ui-btn-active ui-state-persist">社团</a><a href="#as_post_official">校方</a></li>
                         <li class="msg-top-nav-head-right" data-role="controlgroup" data-type="horizontal" data-theme="l"><a href="#as_post_manage" class="ui-btn ui-icon-green-edit1 ui-btn-icon-notext ui-corner-all">发布</a></li>
                    </ul>
               </div>
          </div>
          <!---------------------------------------------个人中心（首）------------------------------------------------------------->
          <div data-role="panel" id="person" data-theme="k" data-display="overlay">
               <script>
                    function showPrivate() {
                         var myIcon;
                         $.ajax({
                              url: "http://123.206.198.158:9093/get_depimage"
                              , data: {
                                   id: ASSID
                              }
                              , cache: true
                              , async: false
                              , type: "POST"
                              , dataType: "text"
                              , success: function (data) {
                                   myIcon = data;
                              }
                         });
                         var myNick;
                         $.ajax({
                              url: "http://123.206.198.158:9093/get_depName"
                              , data: {
                                   id: ASSID
                              }
                              , cache: true
                              , async: false
                              , type: "POST"
                              , dataType: "text"
                              , success: function (data) {
                                   myNick = data;
                              }
                         });
                         $("#myImg").attr("src", myIcon);
                         $("#myNick").attr("value", myNick);
                    }
               </script>
               <script>
                    function aIconUP() {
                         $("#def_one").attr("value", ASSID);
                         var options = {
                              success: function (data) {
                                   alert("修改成功！");
                                   window.location.reload();
                              }
                         };
                         $("#changeIcon").ajaxSubmit(options);
                    }
               </script>
               <div class="choice_list">
                    <ul data-role="listview" data-inset="true">
                         <div class="img-center"> <img id="myImg" alt="头像" class="img-center-img"> </div>
                         <input type="text" id="myNick" value="" contenteditable="false" readonly />
                         <li>
                              <div data-role="collapsible" data-inset="false" data-iconpos="none" data-mini="true">
                                   <h3>修改头像</h3>
                                   <form id="changeIcon" action="http://123.206.198.158:8080/webb/File/TeamUp" enctype="multipart/form-data" method="post">
                                        <input type="hidden" name="team_id" value="" id="def_one" />
                                        <input type="file" data-mini="true" name="newStuIcon_input">
                                        <input type="button" data-mini="true" value="保存" onclick="aIconUP()"> </form>
                              </div>
                         </li>
                         <li>
                              <div data-role="collapsible" data-inset="false" data-iconpos="none" data-mini="true">
                                   <h3>关于APP</h3>
                                   <textarea readonly="readonly">一款极其方便的校园助手APP</textarea>
                              </div>
                         </li>
                         <li>
                              <div data-role="collapsible" data-inset="false" data-iconpos="none" data-mini="true">
                                   <h1>退出登录</h1>
                                   <button onclick="go_index()" data-mini="true">确认</button>
                              </div>
                         </li>
                    </ul>
               </div>
          </div>
          <!----------------------------------------------个人中心 结束------------------------------------------------------>
          <div data-role="content">
               <div class="choice_list">
                    <ul data-role="listview" data-inset="true" id="post_student_student_ul"> </ul>
               </div>
          </div>
     </div>
     <!----------------------------校方活动海报栏------------------------------------>
     <div data-role="page" id="as_post_official" data-theme="s" data-dom-cache="true">
          <!--校方海报栏模板-->
          <script id="student_show_school_post" type="text/html"> {{each list as value i}}
               <li id="student_school_post_list{{i}}">
                    <div class="post-show-div">
                         <div class="post-show-div-inner-left"><img src="{{value.icon}}" alt=""></div>
                         <div class="post-show-div-inner-right">
                              <a href="#popup_school_post{{i+1}}" data-rel="popup" data-position-to="window" data-transition="flow"><img src={{value.pic}} alt=""></a>
                         </div>
                         <div data-role="popup" id="popup_school_post{{i+1}}" data-overlay-theme="s" data-corners="false"><a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-s ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a><img src={{value.pic}} alt=""></div>
                    </div>
               </li> {{/each}} </script>
          <!--海报栏渲染-->
          <script>
               $("#as_post_official").on("pagebeforecreate", function (e) {
                    var receive_post_data2;
                    $.ajax({
                         url: "http://123.206.198.158:9093/get_schoolnews"
                         , data: {}
                         , cache: true
                         , async: false
                         , type: "POST"
                         , dataType: "JSON"
                         , success: function (data) {
                              receive_post_data2 = data;
                         }
                    });
                    var post_data2 = {
                         list: receive_post_data2
                    };
                    $("#post_student_school_ul").append(template("student_show_school_post", post_data2));
               });
          </script>
          <div data-role="header" data-tap-toggle="false" data-position="fixed" data-fullscreen="true" data-theme="s">
               <div data-role="navbar" class="top_nav_bar">
                    <ul>
                         <li class="msg-top-nav-head" data-role="controlgroup" data-type="horizontal"></li>
                         <li class="msg-top-nav" data-role="controlgroup" data-type="horizontal" data-theme="j"><a href="#as_post" data-transition="slide" data-direction="reverse">社团</a><a href="#" class="ui-btn-active ui-state-persist">校方</a></li>
                         <li class="msg-top-nav-head-right" data-role="controlgroup" data-type="horizontal" data-theme="l"><a href="#as_post_manage" class="ui-btn ui-icon-green-edit1 ui-btn-icon-notext ui-corner-all">发布</a></li>
                    </ul>
               </div>
          </div>
          <div data-role="content">
               <div class="choice_list">
                    <ul data-role="listview" data-inset="true" id="post_student_school_ul"> </ul>
               </div>
          </div>
     </div>
     <!--------------------------已发布海报栏管理页面----------------------->
     <div data-role="page" id="as_post_manage" data-theme="s" data-dom-cache="true">
          <!--我的海报栏模板-->
          <script id="as_show_my_post" type="text/html"> {{each list as value i}}
               <li id="student_school_post_list{{i}}">
                    <div class="post-show-div">
                         <div class="post-show-div-inner-left"> <img src={{value.icon}} alt=""> </div>
                         <div class="post-show-div-inner-right">
                              <a href="#popup_post{{i+1}}" data-rel="popup" data-position-to="window" data-transition="flow"><img src={{value.pic}} alt=""></a>
                         </div>
                         <button id={{value.n_id}} onclick="delete_my_post(this)" data-role="button" value="">删除</button>
                         <div data-role="popup" id="popup_post{{i+1}}" data-overlay-theme="s" data-corners="false"> <a href="#" data-rel="back" class="ui-btn ui-corner-all ui-shadow ui-btn-s ui-icon-delete ui-btn-icon-notext ui-btn-right">Close</a> <img src={{value.pic}} alt=""> </div>
                    </div>
               </li> {{/each}} </script>
          <!--我的海报渲染-->
          <script>
               $("#as_post_manage").on("pagebeforecreate", function (e) {
                    var receive_post_data3;
                    $.ajax({
                         url: "http://123.206.198.158:9093/get_my_news"
                         , data: {
                              id: ASSID
                         }
                         , cache: true
                         , async: false
                         , type: "POST"
                         , dataType: "JSON"
                         , success: function (data) {
                              receive_post_data3 = data;
                         }
                    });
                    var post_da = {
                         list: receive_post_data3
                    };
                    $("#post_my_ul").append(template("as_show_my_post", post_da));
               });

               function delete_my_post(self) {
                    var my_post_id = self.id;
                    $.ajax({
                         url: "http://123.206.198.158:9093/remove_news"
                         , data: {
                              id: my_post_id
                         }
                         , cache: false
                         , async: false
                         , type: "post"
                         , dataType: "text"
                         , success: function (data) {
                              window.self.location.reload();
                         }
                    });
               }
          </script>
          <div data-role="header" data-tap-toggle="false" data-position="fixed" data-fullscreen="true" data-theme="s">
               <div data-role="navbar" class="top_nav_bar">
                    <ul>
                         <li class="msg-top-nav-head" data-role="controlgroup" data-type="horizontal" data-theme="l"><a href="#as_post" class="ui-btn ui-icon-green-back1 ui-btn-icon-notext">返回</a></li>
                         <li class="msg-top-nav" data-role="controlgroup" data-type="horizontal" data-theme="l"><a>我的海报</a></li>
                         <li class="msg-top-nav-head-right" data-role="controlgroup" data-type="horizontal" data-theme="l"><a href="#as_post_send" class="ui-btn ui-icon-green-plus1 ui-btn-icon-notext ui-corner-all">发布</a></li>
                    </ul>
               </div>
          </div>
          <div data-role="content">
               <div class="choice_list">
                    <ul data-role="listview" data-inset="true" id="post_my_ul">
                         <!--模板区-->
                    </ul>
               </div>
          </div>
     </div>
     <!----------------------------海报栏发布页面------------------------->
     <div data-role="page" id="as_post_send" data-theme="k">
          <!--script>

               function add_post_check() {
                         $.ajax({
                              url: "http://123.206.198.158:9093/add_lostfound"
                              , data: {
                                   id: "2014020300001"
                                   , pic: $("#post_send_pic").val()
                              }
                              , cache: false
                              , async: false
                              , type: "post"
                              , dataType: "JSON"
                              , success: function (data) {
                                   if (data == true) {
                                        alert("发布成功!");
                                        window.location.href = "#as_post";
                                   }
                                   else {
                                        alert("发布失败!请稍后再试!");
                                   }
                              }
                         });
                    }
          </script-->
          <script>
               function ajaxPostIconUP() {
                    $("#def_two").attr("value", ASSID);
                    var options = {
                         success: function (data) {
                              alert("发布成功！");
                              window.location.reload();
                         }
                    };
                    $("#changePost").ajaxSubmit(options);
               }
          </script>
          <div data-role="header" data-tap-toggle="false" data-theme="s">
               <div data-role="navbar" class="top_nav_bar">
                    <ul>
                         <li class="msg-top-nav-head" data-role="controlgroup" data-type="horizontal" data-theme="l"> <a href="#" data-rel="back" class="ui-btn ui-icon-green-back1 ui-btn-icon-notext">返回</a></li>
                         <li class="msg-top-nav" data-role="controlgroup" data-type="horizontal" data-theme="l"><a>新海报</a></li>
                         <li></li>
                    </ul>
               </div>
          </div>
          <div data-role="content">
               <div class="text-center">
                    <form id="changePost" method="post" action="http://123.206.198.158:8080/webb/File/StuPosterUp">
                         <input type="hidden" name="team_id" value="" id="def_two" />
                         <fieldset data-role="fieldcontain" class="post-send-type"> <span>海报图片:</span>
                              <input name="post_send_pic" id="post_send_pic" type="file" accept="image/jpg">
                              <input type="button" value="发布" class="post-send-submit-btn" data-mini="true" data-inline="true" onclick="ajaxPostIconUP()()"> </fieldset>
                    </form>
               </div>
          </div>
     </div>
</body>

</html>
